package cn.anecansaitin.jep.parser.ast.node;

public record NodeCreationResult<T extends Node>(T node, String message) {
    public boolean success() {
        return node != null;
    }

    public static <T extends Node> NodeCreationResult<T> success(T node) {
        return new NodeCreationResult<>(node, null);
    }

    public static <T extends Node> NodeCreationResult<T> fail(String message) {
        return new NodeCreationResult<>(null, message);
    }
}
